// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#include <pollux/python/vector/PyVector.h>
#include <pollux/vector/complex_vector.h>
#include <pollux/vector/vector_printer.h>

namespace kumo::pollux::py {

std::string PyVector::summarizeToText() const {
  return pollux::VectorPrinter::summarizeToText(*vector_);
}

std::string PyVector::printDetailed() const {
  return pollux::printVector(*vector_);
}

PyVector PyVector::childAt(vector_size_t idx) const {
  if (auto row_vector = std::dynamic_pointer_cast<RowVector>(vector_)) {
    return PyVector{row_vector->childAt(idx), pool_};
  }
  throw std::runtime_error(fmt::format(
      "Can only call child_at() on RowVector, but got '{}'", toString()));
}

} // namespace kumo::pollux::py
